/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taskmanager2ndedition;

import java.util.Date;


public class Task implements ServerTaskInfo{

    private int id;
    private int userId;
    private String name;
    private String description;
    private String contacts;
    private Date expirationDate;
    private TaskStatus status;
    private int version;
    private boolean modified;
    private TaskState stateStatus;
    
    public Task(){}
    /**
     * Constructor
     * @param name
     * @param description
     * @param contacts
     * @param expirationDate
     * @param status 
     * @param id
     * @param userId
     */
    public Task(String name, String description, String contacts, java.util.Date expirationDate){
        this(name, description, contacts, expirationDate, TaskStatus.Opened, 0, 0);
    }
    
    public Task(String name, String description, String contacts, java.util.Date expirationDate, TaskStatus status, int id, int userId){
        this.name = name;
        this.description = description;
        this.contacts = contacts;
        this.expirationDate = expirationDate;
        this.status = status;
        this.id = id;
        this.userId = userId;
        this.version = 0;
        this.modified = true;
    }
    
    public Task(String name, String description, String contacts, java.util.Date expirationDate, TaskStatus status, int id, int userId, int version, boolean modified){
        this(name, description, contacts, expirationDate, status, id, userId);
        this.version = version;
        this.modified = modified;
    }
    
    /**
     * Get user id
     * @return user id
     */
    public int getUserId() {
        return userId;
    }

    public void setUserId(int val) {
        userId = val;
    }
    /**
     * Get task name
     * @return task name
     */
    public String getName() {
        return name;
    }
    
    /**
     * Set task name
     * @param val task name
     */
    public void setName(String val){
        name = val;
    }

    /**
     * Get task description
     * @return task description
     */
    public String getDescription() {
        return description;
    }
    
    /**
     * Set task description
     * @param val task description
     */
    public void setDescription(String val){
        description = val;
    }

    /**
     * Get task contacts
     * @return task contacts
     */
    public String getContacts() {
        return contacts;
    }
    
    /**
     * Set task contacts
     * @param val task contacts
     */
    public void setContacts(String val){
        contacts = val;
    }

    /**
     * Get expiration date
     * @return expiration date
     */
    public java.util.Date getExpirationDate() {
        return expirationDate;
    }
    
    /**
     * Set expiration date
     * @param val expiration date
     */
    public void setExpirationDate(java.util.Date val){
        expirationDate = val;
    }

    /**
     * Get task id
     * @return task id
     */
    public int getId() {
        return id;
    }
    
    public void setId(int val){
        id = val;
    }

    /**
     * Get task status
     * @return task status
     */
    public TaskStatus getStatus() {
        return status;
    }
    
    /**
     * Set task status
     * @param val task status
     */
    public void setStatus(TaskStatus val){
        status = val;
    }
    
    /**
     * Get current version
     * @return version
     */
    public int getVersion() {
        return version;
    }
    
    public void setVersion(int val){
        version = val;
    }
    
    /**
     * Increase version by 1
     */
    public void incVersion(){
        version++;
    }

    public boolean isModified() {
        return modified;
    }
    
    public void setModified(boolean value){
        modified = value;
    }

    public TaskState getState() {
        return stateStatus;
    }
    
    public void setState(TaskState val){
        stateStatus = val;
    }
}
